#pragma once
#include "ArxDatabase.h"

#include "whiptk/whip_toolkit.h"

class DwfParse
{
public:
	DwfParse(AcDbDatabase* pDb)
		: m_database(new CArxDatabase(pDb))
		, m_units(nullptr)
	{
	}

	~DwfParse()
	{
		delete m_database;
		m_database = nullptr;
	}

	Acad::ErrorStatus DrawDwf(const CString& dwfPath, AcDbObjectIdArray& entityIds);
	bool ExtractW2d(const CString& dwfPath, const CString& w2dPath);

protected:
	Acad::ErrorStatus Draw(WT_Drawable* drawable, AcDbObjectId& entityId);
	Acad::ErrorStatus DrawText(WT_Text* text, AcDbObjectId& entityId);
	Acad::ErrorStatus DrawPolyline(WT_Point_Set* polyline, AcDbObjectId& entityId);

	Acad::ErrorStatus DrawEllipse(WT_Ellipse* ellipse, AcDbObjectId& entityId);

	WT_Point3D Transform(const WT_Logical_Point& point);

	double WTAngle2Angle(int wtAngle);

private:
	CArxDatabase* m_database;

	WT_Units* m_units;

	WT_Transform m_transform;
};

